package cn.iocoder.yudao.module.forward.dal.mysql.scope;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.forward.dal.dataobject.scope.ScopeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.forward.controller.admin.scope.vo.*;

/**
 * 授权范围 Mapper
 *
 * @author zhang
 */
@Mapper
public interface ScopeMapper extends BaseMapperX<ScopeDO> {

    default PageResult<ScopeDO> selectPage(ScopePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ScopeDO>()
                .likeIfPresent(ScopeDO::getName, reqVO.getName())
                .eqIfPresent(ScopeDO::getTopicType, reqVO.getTopicType())
                .eqIfPresent(ScopeDO::getBrokerId, reqVO.getBrokerId())
                .eqIfPresent(ScopeDO::getGroupId, reqVO.getGroupId())
                .eqIfPresent(ScopeDO::getEnable, reqVO.getEnable())
                .betweenIfPresent(ScopeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ScopeDO::getId));
    }

}